





<!DOCTYPE html>
<html class="writer-html5" lang="zh-CN" >
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>tvm.relay.dataflow_pattern &mdash; tvm 0.8.dev1982 文档</title>
  

  
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <link rel="stylesheet" href="../../../../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../../../../_static/gallery.css" type="text/css" />
  <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../../_static/css/tlcpack_theme.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../../../_static/tvm-logo-square.png"/>
  

  
  
  
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../../" src="../../../../_static/documentation_options.js"></script>
        <script data-url_root="../../../../" id="documentation_options" src="../../../../_static/documentation_options.js"></script>
        <script src="../../../../_static/jquery.js"></script>
        <script src="../../../../_static/underscore.js"></script>
        <script src="../../../../_static/doctools.js"></script>
        <script src="../../../../_static/translations.js"></script>
    
    <script type="text/javascript" src="../../../../_static/js/theme.js"></script>

    
    <script type="text/javascript" src="../../../../_static/js/tlcpack_theme.js"></script>
    <link rel="index" title="索引" href="../../../../genindex.html" />
    <link rel="search" title="搜索" href="../../../../search.html" />
    <link rel="next" title="tvm.relay.testing" href="testing.html" />
    <link rel="prev" title="tvm.relay.backend" href="backend.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    
<header class="header">
    <div class="innercontainer">
      <div class="headerInner d-flex justify-content-between align-items-center">
          <div class="headerLogo">
               <a href="https://tvm.apache.org/"><img src=https://tvm.apache.org/assets/images/logo.svg alt="logo"></a>
          </div>

          <div id="headMenu" class="headerNav">
            <button type="button" id="closeHeadMenu" class="navCloseBtn"><img src="../../../../_static/img/close-icon.svg" alt="Close"></button>
             <ul class="nav">
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/community>Community</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/download>Download</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/vta>VTA</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/blog>Blog</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/docs>Docs</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvmconf.org>Conference</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://github.com/apache/tvm/>Github</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvmchinese.github.io/declaration_zh_CN.html>About-Translators</a>
                </li>
             </ul>
               <div class="responsivetlcdropdown">
                 <button type="button" class="btn-link">
                   ASF
                 </button>
                 <ul>
                     <li>
                       <a href=https://apache.org/>Apache Homepage</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/licenses/>License</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/sponsorship.html>Sponsorship</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/security/>Security</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/thanks.html>Thanks</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/events/current-event>Events</a>
                     </li>
                     <li>
                       <a href=https://www.zhihu.com/column/c_1429578595417563136>Zhihu</a>
                     </li>
                 </ul>
               </div>
          </div>
            <div class="responsiveMenuIcon">
              <button type="button" id="menuBtn" class="btn-menu"><img src="../../../../_static/img/menu-icon.svg" alt="Menu Icon"></button>
            </div>

            <div class="tlcDropdown">
              <div class="dropdown">
                <button type="button" class="btn-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                  ASF
                </button>
                <div class="dropdown-menu dropdown-menu-right">
                  <ul>
                     <li>
                       <a href=https://apache.org/>Apache Homepage</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/licenses/>License</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/sponsorship.html>Sponsorship</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/security/>Security</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/thanks.html>Thanks</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/events/current-event>Events</a>
                     </li>
                     <li>
                       <a href=https://www.zhihu.com/column/c_1429578595417563136>Zhihu</a>
                     </li>
                  </ul>
                </div>
              </div>
          </div>
       </div>
    </div>
 </header>
 
    <nav data-toggle="wy-nav-shift" class="wy-nav-side fixed">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="../../../../index.html">
          

          
            
            <img src="../../../../_static/tvm-logo-small.png" class="logo" alt="Logo"/>
          
          </a>

          
            
            
                <div class="version">
                  0.8.dev1982
                </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption" role="heading"><span class="caption-text">如何开始</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../../install/index.html">安装 TVM</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../contribute/index.html">贡献者指南</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">用户引导</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../../tutorial/index.html">User Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../how_to/index.html">How To Guides</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">开发者引导</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../../dev/tutorial/index.html">Developer Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../dev/how_to/how_to.html">开发者指南</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">架构指南</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../../arch/index.html">Design and Architecture</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">主题引导</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../../topic/microtvm/index.html">microTVM：裸机使用TVM</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../topic/vta/index.html">VTA: Versatile Tensor Accelerator</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">参考指南</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../langref/index.html">语言参考</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Python API</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../runtime.html">tvm.runtime</a></li>
<li class="toctree-l2"><a class="reference internal" href="../ndarray.html">tvm.runtime.ndarray</a></li>
<li class="toctree-l2"><a class="reference internal" href="../error.html">tvm.error</a></li>
<li class="toctree-l2"><a class="reference internal" href="../ir.html">tvm.ir</a></li>
<li class="toctree-l2"><a class="reference internal" href="../ir.html#module-tvm.instrument">tvm.instrument</a></li>
<li class="toctree-l2"><a class="reference internal" href="../ir.html#module-tvm.transform">tvm.transform</a></li>
<li class="toctree-l2"><a class="reference internal" href="../target.html">tvm.target</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tir.html">tvm.tir</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tir.html#module-tvm.tir.transform">tvm.tir.transform</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tir.html#tvm-tir-analysis">tvm.tir.analysis</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tir.html#module-tvm.tir.stmt_functor">tvm.tir.stmt_functor</a></li>
<li class="toctree-l2"><a class="reference internal" href="../te.html">tvm.te</a></li>
<li class="toctree-l2"><a class="reference internal" href="../te.html#module-tvm.te.hybrid">tvm.te.hybrid</a></li>
<li class="toctree-l2"><a class="reference internal" href="../driver.html">tvm.driver</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html">tvm.relay</a></li>
<li class="toctree-l2"><a class="reference internal" href="frontend.html">tvm.relay.frontend</a></li>
<li class="toctree-l2"><a class="reference internal" href="nn.html">tvm.relay.nn</a></li>
<li class="toctree-l2"><a class="reference internal" href="vision.html">tvm.relay.vision</a></li>
<li class="toctree-l2"><a class="reference internal" href="image.html">tvm.relay.image</a></li>
<li class="toctree-l2"><a class="reference internal" href="transform.html">tvm.relay.transform</a></li>
<li class="toctree-l2"><a class="reference internal" href="analysis.html">tvm.relay.analysis</a></li>
<li class="toctree-l2"><a class="reference internal" href="backend.html">tvm.relay.backend</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">tvm.relay.dataflow_pattern</a></li>
<li class="toctree-l2"><a class="reference internal" href="testing.html">tvm.relay.testing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../autotvm.html">tvm.autotvm</a></li>
<li class="toctree-l2"><a class="reference internal" href="../auto_scheduler.html">tvm.auto_scheduler</a></li>
<li class="toctree-l2"><a class="reference internal" href="../rpc.html">tvm.rpc</a></li>
<li class="toctree-l2"><a class="reference internal" href="../micro.html">tvm.micro</a></li>
<li class="toctree-l2"><a class="reference internal" href="../contrib.html">tvm.contrib</a></li>
<li class="toctree-l2"><a class="reference internal" href="../graph_executor.html">tvm.contrib.graph_executor</a></li>
<li class="toctree-l2"><a class="reference internal" href="../topi.html">tvm.topi</a></li>
<li class="toctree-l2"><a class="reference internal" href="../vta/index.html">vta</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../links.html">Other APIs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../publications.html">Publications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../genindex.html">索引</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
      
      <nav class="wy-nav-top" aria-label="top navigation" data-toggle="wy-nav-top">
        
            <div class="togglemenu">

            </div>
            <div class="nav-content">
              <!-- tvm -->
              Table of content
            </div>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        

          




















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../../index.html">Docs</a> <span class="br-arrow">></span></li>
        
          <li><a href="../index.html">Python API</a> <span class="br-arrow">></span></li>
        
      <li>tvm.relay.dataflow_pattern</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="../../../../_sources/reference/api/python/relay/dataflow_pattern.rst.txt" rel="nofollow"> <img src="../../../../_static//img/source.svg" alt="viewsource"/></a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="module-tvm.relay.dataflow_pattern">
<span id="tvm-relay-dataflow-pattern"></span><h1>tvm.relay.dataflow_pattern<a class="headerlink" href="#module-tvm.relay.dataflow_pattern" title="永久链接至标题">¶</a></h1>
<p>The Relay Pattern Language and tooling.</p>
<p><strong>类：</strong></p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">Callable</span></code>(*args, **kwds)</p></td>
<td><p>Callable type; Callable[[int], str] is a function of (int) -&gt; str.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">Dict</span></code>(*args, **kwds)</p></td>
<td><p></p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">List</span></code>(*args, **kwds)</p></td>
<td><p></p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">Expr</span></code></p></td>
<td><p>alias of <a class="reference internal" href="../ir.html#tvm.ir.RelayExpr" title="tvm.ir.expr.RelayExpr"><code class="xref py py-class docutils literal notranslate"><span class="pre">tvm.ir.expr.RelayExpr</span></code></a></p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">DFPattern</span></code>()</p></td>
<td><p>Base class of all Patterns.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">ExprPattern</span></code>(expr)</p></td>
<td><p>A pattern which matches a constant expression.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">VarPattern</span></code>(name_hint)</p></td>
<td><p>A local variable in Relay.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">ConstantPattern</span></code>()</p></td>
<td><p>A pattern matching a Relay Constant.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">CallPattern</span></code>(op, args)</p></td>
<td><p>A pattern matching a function call node in Relay.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">FunctionPattern</span></code>(params, body)</p></td>
<td><p>A pattern matching a function node in Relay.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">IfPattern</span></code>(cond, true_branch, false_branch)</p></td>
<td><p>A patern matching a Relay If.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">LetPattern</span></code>(var, value, body)</p></td>
<td><p>A patern matching a Relay Let.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">TuplePattern</span></code>(fields)</p></td>
<td><p>A patern matching a Relay Tuple.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">TupleGetItemPattern</span></code>(tuple_value, index)</p></td>
<td><p>Get index-th item from a TuplePattern.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">AltPattern</span></code>(left, right)</p></td>
<td><p>Create a Pattern that can match one of two conditions</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">WildcardPattern</span></code>()</p></td>
<td><p>A pattern which matches anything.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">TypePattern</span></code>(pattern, ttype)</p></td>
<td><p>A pattern that matches another pattern with a certain type annotation.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">DataTypePattern</span></code>(pattern, dtype)</p></td>
<td><p>A pattern that matches another pattern with certain data type</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">ShapePattern</span></code>(pattern, shape)</p></td>
<td><p>A pattern that matches another pattern with a certain tensor shape</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">AttrPattern</span></code>(pattern, attrs)</p></td>
<td><p>Get match an expression with a certain attributes.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">DominatorPattern</span></code>(parent, path, child)</p></td>
<td><p>Match a domination graph.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">DFPatternCallback</span></code>([require_type, rewrite_once])</p></td>
<td><p>A Callback for Pattern Rewriting.</p></td>
</tr>
</tbody>
</table>
<p><strong>函数：</strong></p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">make_node</span></code>(type_key, **kwargs)</p></td>
<td><p>Make a new IR node by its type key and fields</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">get</span></code>(op_name)</p></td>
<td><p>Get the Op for a given name</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">register_df_node</span></code>([type_key])</p></td>
<td><p>Register a Relay node type.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_var</span></code>([name])</p></td>
<td><p>Syntatic sugar for creating an optionally named VarPattern.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_constant</span></code>()</p></td>
<td><p>Syntatic sugar for creating a ConstantPattern.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_expr</span></code>(expr)</p></td>
<td><p>Syntatic sugar for creating an ExprPattern.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_op</span></code>(op_name)</p></td>
<td><p>Syntatic sugar for creating an operator ExprPattern.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_tuple</span></code>(fields)</p></td>
<td><p>Syntatic sugar for creating an ExprPattern.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_tuple_get_item</span></code>(tuple_value[, index])</p></td>
<td><p>Syntatic sugar for creating an ExprPattern.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_if</span></code>(cond, true_branch, false_branch)</p></td>
<td><p>Syntatic sugar for creating an IfPattern.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_let</span></code>(var, value, body)</p></td>
<td><p>Syntatic sugar for creating a LetPattern.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">wildcard</span></code>()</p></td>
<td><p>Syntatic sugar for creating a WildcardPattern.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">has_type</span></code>(ttype[, pattern])</p></td>
<td><p>Syntatic sugar for creating a TypePattern</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">has_dtype</span></code>(dtype[, pattern])</p></td>
<td><p>Syntatic sugar for creating a DataTypePattern</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">has_shape</span></code>(shape[, pattern])</p></td>
<td><p>Syntatic sugar for creating a ShapePattern</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">has_attr</span></code>(attrs[, pattern])</p></td>
<td><p>Syntatic sugar for creating an AttrPattern</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">dominates</span></code>(parent, path, child)</p></td>
<td><p>Syntatic sugar for creating an Dominator pattern</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">match</span></code>(pattern, expr)</p></td>
<td><p>Match a pattern to an expression</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">rewrite</span></code>(callbacks, expr[, mod])</p></td>
<td><p>Rewrite expression with the given callbacks.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">partition</span></code>(pattern, expr[, attrs, check])</p></td>
<td><p>Parition the expression into a series of functions that match the pattern</p></td>
</tr>
</tbody>
</table>
<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.Callable">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">Callable</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.Callable" title="永久链接至目标">¶</a></dt>
<dd><p>Callable type; Callable[[int], str] is a function of (int) -&gt; str.</p>
<p>The subscription syntax must always be used with exactly two
values: the argument list and the return type.  The argument list
must be a list of types or ellipsis; the return type must be a single type.</p>
<p>There is no syntax to indicate optional or keyword arguments,
such function types are rarely used as callback types.</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.Dict">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">Dict</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.Dict" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.List">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">List</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.List" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.Expr">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">Expr</span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.Expr" title="永久链接至目标">¶</a></dt>
<dd><p>alias of <a class="reference internal" href="../ir.html#tvm.ir.RelayExpr" title="tvm.ir.expr.RelayExpr"><code class="xref py py-class docutils literal notranslate"><span class="pre">tvm.ir.expr.RelayExpr</span></code></a>
<strong>Attributes:</strong></p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">checked_type</span></code></p></td>
<td><p>Get the checked type of tvm.relay.Expr.</p></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.make_node">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">make_node</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">type_key</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.make_node" title="永久链接至目标">¶</a></dt>
<dd><p>Make a new IR node by its type key and fields</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>type_key</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The type key of the node.</p></li>
<li><p><strong>**kwargs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)"><em>dict</em></a>) – The fields of the node.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>node</strong> – The corresponding IR Node</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.ir.Node" title="tvm.ir.Node">Node</a></p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>If the created node is instance of AttrsNode, then
the creator function will also run bound checks and
default value setup as supported by Attrs.</p>
</div>
<p class="rubric">示例</p>
<p>The following code constructs a IntImm object</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="n">tvm</span><span class="o">.</span><span class="n">ir</span><span class="o">.</span><span class="n">make_node</span><span class="p">(</span><span class="s2">&quot;IntImm&quot;</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="s2">&quot;int32&quot;</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
<span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">tvm</span><span class="o">.</span><span class="n">tir</span><span class="o">.</span><span class="n">IntImm</span><span class="p">)</span>
<span class="k">assert</span> <span class="n">x</span><span class="o">.</span><span class="n">value</span> <span class="o">==</span> <span class="mi">10</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.get">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">get</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">op_name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.get" title="永久链接至目标">¶</a></dt>
<dd><p>Get the Op for a given name</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>op_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The operator name</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>op</strong> – The op of the corresponding name</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.ir.Op" title="tvm.ir.Op">Op</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.register_df_node">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">register_df_node</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">type_key</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.register_df_node" title="永久链接至目标">¶</a></dt>
<dd><p>Register a Relay node type.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>type_key</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em> or </em><em>cls</em>) – The type key of the node.</p>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.DFPattern">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">DFPattern</span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.DFPattern" title="永久链接至目标">¶</a></dt>
<dd><p>Base class of all Patterns.</p>
<p><strong>Methods:</strong></p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">has_attr</span></code>(attrs)</p></td>
<td><p>Add an attribute constraint to this pattern</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">has_type</span></code>(ttype)</p></td>
<td><p>Add a type constraint to this pattern</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">has_dtype</span></code>(dtype)</p></td>
<td><p>Add a type constraint to this pattern</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">has_shape</span></code>(shape)</p></td>
<td><p>Add a type constraint to this pattern</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">match</span></code>(expr)</p></td>
<td><p>Match this pattern to an expression</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">partition</span></code>(expr[, attrs, check])</p></td>
<td><p>Partition the expression into functions defined by this pattern</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">dominates</span></code>(parent[, path])</p></td>
<td><p>Create a dominator for this pattern.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">optional</span></code>(option_constructor)</p></td>
<td><p>Create a optional user of this pattern.</p></td>
</tr>
</tbody>
</table>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.DFPattern.has_attr">
<span class="sig-name descname"><span class="pre">has_attr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">attrs</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.Dict" title="tvm.relay.dataflow_pattern.Dict"><span class="pre">Dict</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><span class="pre">str</span></a><span class="p"><span class="pre">,</span> </span><a class="reference internal" href="../runtime.html#tvm.runtime.Object" title="tvm.runtime.object.Object"><span class="pre">tvm.runtime.object.Object</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.DFPattern.has_attr" title="永久链接至目标">¶</a></dt>
<dd><p>Add an attribute constraint to this pattern</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>attrs</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.Dict" title="tvm.relay.dataflow_pattern.Dict"><em>Dict</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><a class="reference internal" href="../runtime.html#tvm.runtime.Object" title="tvm.runtime.Object"><em>Object</em></a><em>]</em>) – </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting AttrPattern</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.DFPattern.has_type">
<span class="sig-name descname"><span class="pre">has_type</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ttype</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../ir.html#tvm.ir.Type" title="tvm.ir.type.Type"><span class="pre">tvm.ir.type.Type</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.DFPattern.has_type" title="永久链接至目标">¶</a></dt>
<dd><p>Add a type constraint to this pattern</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>ttype</strong> (<a class="reference internal" href="../ir.html#tvm.ir.Type" title="tvm.ir.type.Type"><em>tvm.ir.type.Type</em></a>) – The type to match</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting TypePattern</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.DFPattern.has_dtype">
<span class="sig-name descname"><span class="pre">has_dtype</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dtype</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.DFPattern.has_dtype" title="永久链接至目标">¶</a></dt>
<dd><p>Add a type constraint to this pattern</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>dtype</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The dtype to match</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting DataTypePattern</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.DFPattern.has_shape">
<span class="sig-name descname"><span class="pre">has_shape</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">shape</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><span class="pre">List</span></a><span class="p"><span class="pre">[</span></span><a class="reference internal" href="../ir.html#tvm.ir.PrimExpr" title="tvm.ir.expr.PrimExpr"><span class="pre">tvm.ir.expr.PrimExpr</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.DFPattern.has_shape" title="永久链接至目标">¶</a></dt>
<dd><p>Add a type constraint to this pattern</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>shape</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a><em>[</em><a class="reference internal" href="../ir.html#tvm.ir.PrimExpr" title="tvm.ir.PrimExpr"><em>tvm.ir.PrimExpr</em></a><em>]</em>) – The shape to match</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting ShapePattern</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.DFPattern.match">
<span class="sig-name descname"><span class="pre">match</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../ir.html#tvm.ir.RelayExpr" title="tvm.ir.expr.RelayExpr"><span class="pre">tvm.ir.expr.RelayExpr</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><span class="pre">bool</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.DFPattern.match" title="永久链接至目标">¶</a></dt>
<dd><p>Match this pattern to an expression</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>expr</strong> (<em>tvm.relay.Expr</em>) – The expression to match.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – Whether or not the expression matches the pattern</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)">bool</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.DFPattern.partition">
<span class="sig-name descname"><span class="pre">partition</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">expr:</span> <span class="pre">tvm.ir.expr.RelayExpr</span></em>, <em class="sig-param"><span class="pre">attrs:</span> <span class="pre">Optional[Dict[str</span></em>, <em class="sig-param"><span class="pre">tvm.runtime.object.Object]]</span> <span class="pre">=</span> <span class="pre">None</span></em>, <em class="sig-param"><span class="pre">check:</span> <span class="pre">Callable[tvm.ir.expr.RelayExpr</span></em>, <em class="sig-param"><span class="pre">bool]</span> <span class="pre">=</span> <span class="pre">&lt;function</span> <span class="pre">DFPattern.&lt;lambda&gt;&gt;</span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="../ir.html#tvm.ir.RelayExpr" title="tvm.ir.expr.RelayExpr"><span class="pre">tvm.ir.expr.RelayExpr</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.DFPattern.partition" title="永久链接至目标">¶</a></dt>
<dd><p>Partition the expression into functions defined by this pattern</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>expr</strong> (<em>tvm.relay.Expr</em>) – The expression to match.</p></li>
<li><p><strong>attrs</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="#tvm.relay.dataflow_pattern.Dict" title="tvm.relay.dataflow_pattern.Dict"><em>Dict</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><a class="reference internal" href="../runtime.html#tvm.runtime.Object" title="tvm.runtime.Object"><em>Object</em></a><em>]</em><em>]</em>) – A dictionary of Attribute name/values to add to the paritioned function</p></li>
<li><p><strong>check</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.Callable" title="tvm.relay.dataflow_pattern.Callable"><em>Callable</em></a><em>[</em><em>[</em><em>Expr</em><em>]</em><em>, </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a><em>]</em>) – A function to perform more complicated checks on the matched expression.
Returns true if partitioning should proceed, false otherwise.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The Expression with matched subgraphs replaced by function calls to that subgraph</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>tvm.relay.Expr</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.DFPattern.dominates">
<span class="sig-name descname"><span class="pre">dominates</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">parent</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.DFPattern.dominates" title="永久链接至目标">¶</a></dt>
<dd><p>Create a dominator for this pattern.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>parent</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The parent pattern this pattern dominates.</p></li>
<li><p><strong>path</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The fuzzy path pattern.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting DominatorPattern.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.DFPattern.optional">
<span class="sig-name descname"><span class="pre">optional</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">option_constructor</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.Callable" title="tvm.relay.dataflow_pattern.Callable"><span class="pre">Callable</span></a><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a><span class="p"><span class="pre">,</span> </span><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.DFPattern.optional" title="永久链接至目标">¶</a></dt>
<dd><p>Create a optional user of this pattern.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>option_constructor</strong> (<em>function</em>) – A function that takes a single Pattern parameter and returns
a constructed pattern matching the option</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting Pattern</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.is_var">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">is_var</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><span class="pre">str</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.is_var" title="永久链接至目标">¶</a></dt>
<dd><p>Syntatic sugar for creating an optionally named VarPattern.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The name of the input pattern to match.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting pattern.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.is_constant">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">is_constant</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.is_constant" title="永久链接至目标">¶</a></dt>
<dd><p>Syntatic sugar for creating a ConstantPattern.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The name of the input pattern to match.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting pattern.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.is_expr">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">is_expr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../ir.html#tvm.ir.RelayExpr" title="tvm.ir.expr.RelayExpr"><span class="pre">tvm.ir.expr.RelayExpr</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.is_expr" title="永久链接至目标">¶</a></dt>
<dd><p>Syntatic sugar for creating an ExprPattern.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>expr</strong> (<em>Expr</em>) – The Relay expression to match.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting pattern.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.is_op">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">is_op</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">op_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.is_op" title="永久链接至目标">¶</a></dt>
<dd><p>Syntatic sugar for creating an operator ExprPattern.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>op_name</strong> (<a class="reference internal" href="../runtime.html#tvm.runtime.String" title="tvm.runtime.String"><em>String</em></a>) – The name of the relay op</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting ExprPattern</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.is_tuple">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">is_tuple</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fields</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../ir.html#tvm.ir.Array" title="tvm.ir.container.Array"><span class="pre">tvm.ir.container.Array</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.is_tuple" title="永久链接至目标">¶</a></dt>
<dd><p>Syntatic sugar for creating an ExprPattern.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>fields</strong> (<a class="reference internal" href="../ir.html#tvm.ir.Array" title="tvm.ir.Array"><em>Array</em></a><em>[</em><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a><em>]</em>) – The fields in the tuple.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting pattern.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.is_tuple_get_item">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">is_tuple_get_item</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tuple_value</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">index</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><span class="pre">int</span></a><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.is_tuple_get_item" title="永久链接至目标">¶</a></dt>
<dd><p>Syntatic sugar for creating an ExprPattern.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tuple_value</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The input tuple expression.</p></li>
<li><p><strong>index</strong> (<em>Optional</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>]</em>) – The index to match; Default (None) to match a TupleGetItem with any index.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting pattern.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.is_if">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">is_if</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cond</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">true_branch</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">false_branch</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.is_if" title="永久链接至目标">¶</a></dt>
<dd><p>Syntatic sugar for creating an IfPattern.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>cond</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The pattern describing the condition of If.</p></li>
<li><p><strong>true_branch</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The pattern describing the true branch of If.</p></li>
<li><p><strong>false_branch</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The pattern describing the false branch of If.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting pattern.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.is_let">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">is_let</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">var</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">body</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.is_let" title="永久链接至目标">¶</a></dt>
<dd><p>Syntatic sugar for creating a LetPattern.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>var</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The pattern describing the variable of Let.</p></li>
<li><p><strong>value</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The pattern describing the value of Let.</p></li>
<li><p><strong>body</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The pattern describing the body where the binding is in effect.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting pattern.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.wildcard">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">wildcard</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.wildcard" title="永久链接至目标">¶</a></dt>
<dd><p>Syntatic sugar for creating a WildcardPattern.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>result</strong> – The resulting pattern.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.has_type">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">has_type</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ttype</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../ir.html#tvm.ir.Type" title="tvm.ir.type.Type"><span class="pre">tvm.ir.type.Type</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">pattern</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.has_type" title="永久链接至目标">¶</a></dt>
<dd><p>Syntatic sugar for creating a TypePattern</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ttype</strong> (<a class="reference internal" href="../ir.html#tvm.ir.Type" title="tvm.ir.type.Type"><em>tvm.ir.type.Type</em></a>) – The type to match</p></li>
<li><p><strong>pattern</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The pattern that needs type annotation</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting TypePattern</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.has_dtype">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">has_dtype</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dtype</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">pattern</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.has_dtype" title="永久链接至目标">¶</a></dt>
<dd><p>Syntatic sugar for creating a DataTypePattern</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>dtype</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The dtype to match</p></li>
<li><p><strong>pattern</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The pattern that needs type annotation</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting DataTypePattern</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.has_shape">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">has_shape</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">shape</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><span class="pre">List</span></a><span class="p"><span class="pre">[</span></span><a class="reference internal" href="../ir.html#tvm.ir.PrimExpr" title="tvm.ir.expr.PrimExpr"><span class="pre">tvm.ir.expr.PrimExpr</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pattern</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.has_shape" title="永久链接至目标">¶</a></dt>
<dd><p>Syntatic sugar for creating a ShapePattern</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>shape</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a><em>[</em><a class="reference internal" href="../ir.html#tvm.ir.PrimExpr" title="tvm.ir.PrimExpr"><em>tvm.ir.PrimExpr</em></a><em>]</em>) – The shape to match</p></li>
<li><p><strong>pattern</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The pattern that needs type annotation</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting ShapePattern</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.has_attr">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">has_attr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">attrs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pattern</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.has_attr" title="永久链接至目标">¶</a></dt>
<dd><p>Syntatic sugar for creating an AttrPattern</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>attrs</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.Dict" title="tvm.relay.dataflow_pattern.Dict"><em>Dict</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><a class="reference internal" href="../runtime.html#tvm.runtime.Object" title="tvm.runtime.Object"><em>Object</em></a><em>]</em>) – The attributes to match</p></li>
<li><p><strong>pattern</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a><em>]</em>) – The input pattern.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting AttrPattern</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.dominates">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">dominates</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">parent</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">child</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.dominates" title="永久链接至目标">¶</a></dt>
<dd><p>Syntatic sugar for creating an Dominator pattern</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>parent</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The parent pattern.</p></li>
<li><p><strong>path</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The fuzzy path pattern.</p></li>
<li><p><strong>child</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The child pattern.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The resulting DominatorPattern.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern">tvm.relay.dataflow_pattern.DFPattern</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.match">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">match</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pattern</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">expr</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../ir.html#tvm.ir.RelayExpr" title="tvm.ir.expr.RelayExpr"><span class="pre">tvm.ir.expr.RelayExpr</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><span class="pre">bool</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.match" title="永久链接至目标">¶</a></dt>
<dd><p>Match a pattern to an expression</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>pattern</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The input pattern.</p></li>
<li><p><strong>expr</strong> (<em>tvm.relay.Expr</em>) – The expression to match.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.ExprPattern">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">ExprPattern</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../ir.html#tvm.ir.RelayExpr" title="tvm.ir.expr.RelayExpr"><span class="pre">tvm.ir.expr.RelayExpr</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.ExprPattern" title="永久链接至目标">¶</a></dt>
<dd><p>A pattern which matches a constant expression.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>expr</strong> (<em>tvm.relay.Expr</em>) – The expression to match.</p>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.VarPattern">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">VarPattern</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name_hint</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><span class="pre">str</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.VarPattern" title="永久链接至目标">¶</a></dt>
<dd><p>A local variable in Relay.</p>
<p>Local variable can be used to declare input
arguments to a function, or intermediate variables.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name_hint</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The name of the variable. Optional, if not provided,
the pattern will match any VarNode.</p></li>
<li><p><strong>type_annotation</strong> (<a class="reference internal" href="../ir.html#tvm.ir.Type" title="tvm.ir.type.Type"><em>tvm.ir.type.Type</em></a><em>, </em><em>optional</em>) – The type annotation on the variable.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.ConstantPattern">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">ConstantPattern</span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.ConstantPattern" title="永久链接至目标">¶</a></dt>
<dd><p>A pattern matching a Relay Constant.</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.CallPattern">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">CallPattern</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">op</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><span class="pre">List</span></a><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.CallPattern" title="永久链接至目标">¶</a></dt>
<dd><p>A pattern matching a function call node in Relay.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>op</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>relay.dataflow_pattern.DFPattern</em></a>) – The operation to be called.</p></li>
<li><p><strong>args</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a><em>[</em><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>relay.dataflow_pattern.DFPattern</em></a><em>]</em>) – The arguments to the call or None to match any arguments.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.FunctionPattern">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">FunctionPattern</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">params</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><span class="pre">List</span></a><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">body</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.FunctionPattern" title="永久链接至目标">¶</a></dt>
<dd><p>A pattern matching a function node in Relay.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>params</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a><em>[</em><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>relay.dataflow_pattern.DFPattern</em></a><em>]</em>) – The parameters to the Function or None to match any parameters.</p></li>
<li><p><strong>body</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>relay.dataflow_pattern.DFPattern</em></a>) – The body fo the Function</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.IfPattern">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">IfPattern</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cond</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">true_branch</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">false_branch</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.IfPattern" title="永久链接至目标">¶</a></dt>
<dd><p>A patern matching a Relay If.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>cond</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The pattern describing the condition of If.</p></li>
<li><p><strong>true_branch</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The pattern describing the true branch of If.</p></li>
<li><p><strong>false_branch</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The pattern describing the false branch of If.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.LetPattern">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">LetPattern</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">var</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">body</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.LetPattern" title="永久链接至目标">¶</a></dt>
<dd><p>A patern matching a Relay Let.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>var</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The pattern describing the variable of Let.</p></li>
<li><p><strong>value</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The pattern describing the value of Let.</p></li>
<li><p><strong>body</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The pattern describing the body where the binding is in effect.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.TuplePattern">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">TuplePattern</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fields</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../ir.html#tvm.ir.Array" title="tvm.ir.container.Array"><span class="pre">tvm.ir.container.Array</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.TuplePattern" title="永久链接至目标">¶</a></dt>
<dd><p>A patern matching a Relay Tuple.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>fields</strong> (<a class="reference internal" href="../ir.html#tvm.ir.Array" title="tvm.ir.Array"><em>Array</em></a><em>[</em><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a><em>]</em>) – The fields in the tuple.</p>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.TupleGetItemPattern">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">TupleGetItemPattern</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tuple_value</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">index</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><span class="pre">int</span></a><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.TupleGetItemPattern" title="永久链接至目标">¶</a></dt>
<dd><p>Get index-th item from a TuplePattern.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tuple_value</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The input tuple expression.</p></li>
<li><p><strong>index</strong> (<em>Optional</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>]</em>) – The index to match; Default (None) to match a TupleGetItem with any index.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.AltPattern">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">AltPattern</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">right</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.AltPattern" title="永久链接至目标">¶</a></dt>
<dd><p>Create a Pattern that can match one of two conditions</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>left</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – One possible matching pattern.</p></li>
<li><p><strong>right</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – One possible matching pattern.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.WildcardPattern">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">WildcardPattern</span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.WildcardPattern" title="永久链接至目标">¶</a></dt>
<dd><p>A pattern which matches anything.</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.TypePattern">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">TypePattern</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pattern</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">ttype</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../ir.html#tvm.ir.Type" title="tvm.ir.type.Type"><span class="pre">tvm.ir.type.Type</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.TypePattern" title="永久链接至目标">¶</a></dt>
<dd><p>A pattern that matches another pattern with a certain type annotation.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>pattern</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The input pattern that needs type annotation.</p></li>
<li><p><strong>ttype</strong> (<a class="reference internal" href="../ir.html#tvm.ir.Type" title="tvm.ir.type.Type"><em>tvm.ir.type.Type</em></a>) – The type to match.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.DataTypePattern">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">DataTypePattern</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pattern</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">dtype</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.DataTypePattern" title="永久链接至目标">¶</a></dt>
<dd><p>A pattern that matches another pattern with certain data type</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>pattern</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The input pattern that needs type annotation.</p></li>
<li><p><strong>dtype</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The dtype to match.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.ShapePattern">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">ShapePattern</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pattern</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">shape</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><span class="pre">List</span></a><span class="p"><span class="pre">[</span></span><a class="reference internal" href="../ir.html#tvm.ir.PrimExpr" title="tvm.ir.expr.PrimExpr"><span class="pre">tvm.ir.expr.PrimExpr</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.ShapePattern" title="永久链接至目标">¶</a></dt>
<dd><p>A pattern that matches another pattern with a certain tensor shape</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>pattern</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The input pattern that needs type annotation.</p></li>
<li><p><strong>shape</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a><em>[</em><a class="reference internal" href="../ir.html#tvm.ir.PrimExpr" title="tvm.ir.PrimExpr"><em>tvm.ir.PrimExpr</em></a><em>]</em>) – The shape to match.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.AttrPattern">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">AttrPattern</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pattern</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">attrs</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../ir.html#tvm.ir.Attrs" title="tvm.ir.attrs.Attrs"><span class="pre">tvm.ir.attrs.Attrs</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.AttrPattern" title="永久链接至目标">¶</a></dt>
<dd><p>Get match an expression with a certain attributes.
Currently only supports Op Attributes, not call Attributes.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>pattern</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The input pattern.</p></li>
<li><p><strong>attrs</strong> (<a class="reference internal" href="../ir.html#tvm.ir.Attrs" title="tvm.ir.attrs.Attrs"><em>tvm.ir.attrs.Attrs</em></a>) – The attributes to match.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.DominatorPattern">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">DominatorPattern</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">parent</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">child</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.DominatorPattern" title="永久链接至目标">¶</a></dt>
<dd><p>Match a domination graph.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>parent</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The parent, i.e., the single node which produces something,
later aggregated by the child.</p></li>
<li><p><strong>path</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The fuzzy path pattern between parent and child,
typically matches elementwise ops.</p></li>
<li><p><strong>child</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The last node in the domination which is the end user
for all nodes in the path and the parent.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.DFPatternCallback">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">DFPatternCallback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">require_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rewrite_once</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.dataflow_pattern.DFPatternCallback" title="永久链接至目标">¶</a></dt>
<dd><p>A Callback for Pattern Rewriting.</p>
<p>When rewrite is called on this DFPatternCallback, the backend will find matches for the
pattern, call the callback function, and replace the matched expression with whatever
the callback returns.</p>
<p>Users are expect to inherit from this class and provide a “self.pattern” to match</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>require_type</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether InferType is required to be run before the callback.</p></li>
<li><p><strong>rewrite_once</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – If True, run the callback only once.</p></li>
</ul>
</dd>
</dl>
<p><strong>Methods:</strong></p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">rewrite</span></code>(expr)</p></td>
<td><p>Rewrite expression with this callback</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">callback</span></code>(pre, post, node_map)</p></td>
<td><p>Callback function to use when we found a match to the pattern</p></td>
</tr>
</tbody>
</table>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.DFPatternCallback.rewrite">
<span class="sig-name descname"><span class="pre">rewrite</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../ir.html#tvm.ir.RelayExpr" title="tvm.ir.expr.RelayExpr"><span class="pre">tvm.ir.expr.RelayExpr</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="../ir.html#tvm.ir.RelayExpr" title="tvm.ir.expr.RelayExpr"><span class="pre">tvm.ir.expr.RelayExpr</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.DFPatternCallback.rewrite" title="永久链接至目标">¶</a></dt>
<dd><p>Rewrite expression with this callback</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>expr</strong> (<em>tvm.relay.Expr</em>) – The expression to rewrite.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The Expression with matched subgraphs rewritten by the callbacks.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>tvm.relay.Expr</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.DFPatternCallback.callback">
<span class="sig-name descname"><span class="pre">callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pre</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../ir.html#tvm.ir.RelayExpr" title="tvm.ir.expr.RelayExpr"><span class="pre">tvm.ir.expr.RelayExpr</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">post</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../ir.html#tvm.ir.RelayExpr" title="tvm.ir.expr.RelayExpr"><span class="pre">tvm.ir.expr.RelayExpr</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">node_map</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../ir.html#tvm.ir.Map" title="tvm.ir.container.Map"><span class="pre">tvm.ir.container.Map</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="../ir.html#tvm.ir.RelayExpr" title="tvm.ir.expr.RelayExpr"><span class="pre">tvm.ir.expr.RelayExpr</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.DFPatternCallback.callback" title="永久链接至目标">¶</a></dt>
<dd><p>Callback function to use when we found a match to the pattern</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>pre</strong> (<em>tvm.relay.Expr</em>) – The matching expression from the original graph.</p></li>
<li><p><strong>post</strong> (<em>tvm.relay.Expr</em>) – The matching expression with rewritten inputs</p></li>
<li><p><strong>node_map</strong> (<a class="reference internal" href="../ir.html#tvm.ir.Map" title="tvm.ir.container.Map"><em>tvm.ir.container.Map</em></a><em>[</em><a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>DFPattern</em></a><em>, </em><a class="reference internal" href="#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a><em>[</em><em>Expr</em><em>]</em><em>]</em>) – The map between patterns and matched expressions</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The Expression with matched subgraph rewritten by the callback</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>tvm.relay.Expr</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.rewrite">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">rewrite</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callbacks</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">expr</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../ir.html#tvm.ir.RelayExpr" title="tvm.ir.expr.RelayExpr"><span class="pre">tvm.ir.expr.RelayExpr</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">mod</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="../ir.html#tvm.ir.IRModule" title="tvm.ir.module.IRModule"><span class="pre">tvm.ir.module.IRModule</span></a><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="../ir.html#tvm.ir.RelayExpr" title="tvm.ir.expr.RelayExpr"><span class="pre">tvm.ir.expr.RelayExpr</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.rewrite" title="永久链接至目标">¶</a></dt>
<dd><p>Rewrite expression with the given callbacks.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>callbacks</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPatternCallback" title="tvm.relay.dataflow_pattern.DFPatternCallback"><em>tvm.relay.dataflow_pattern.DFPatternCallback</em></a>) – The input callback or list of callbacks.</p></li>
<li><p><strong>expr</strong> (<em>tvm.relay.Expr</em>) – The expression to rewrite.</p></li>
<li><p><strong>mod</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="../ir.html#tvm.ir.IRModule" title="tvm.ir.IRModule"><em>tvm.ir.IRModule</em></a><em>]</em>) – The module that associates with the expression.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The Expression with matched subgraphs rewritten by the callbacks.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>tvm.relay.Expr</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.dataflow_pattern.partition">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.dataflow_pattern.</span></span><span class="sig-name descname"><span class="pre">partition</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">pattern:</span> <span class="pre">tvm.relay.dataflow_pattern.DFPattern</span></em>, <em class="sig-param"><span class="pre">expr:</span> <span class="pre">tvm.ir.expr.RelayExpr</span></em>, <em class="sig-param"><span class="pre">attrs:</span> <span class="pre">Optional[Dict[str</span></em>, <em class="sig-param"><span class="pre">tvm.runtime.object.Object]]</span> <span class="pre">=</span> <span class="pre">None</span></em>, <em class="sig-param"><span class="pre">check:</span> <span class="pre">Callable[tvm.ir.expr.RelayExpr</span></em>, <em class="sig-param"><span class="pre">bool]</span> <span class="pre">=</span> <span class="pre">&lt;function</span> <span class="pre">&lt;lambda&gt;&gt;</span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="../ir.html#tvm.ir.RelayExpr" title="tvm.ir.expr.RelayExpr"><span class="pre">tvm.ir.expr.RelayExpr</span></a></span></span><a class="headerlink" href="#tvm.relay.dataflow_pattern.partition" title="永久链接至目标">¶</a></dt>
<dd><p>Parition the expression into a series of functions that match the pattern</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>pattern</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a>) – The pattern to match</p></li>
<li><p><strong>expr</strong> (<em>tvm.relay.Expr</em>) – The expression to split into functions</p></li>
<li><p><strong>attrs</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="#tvm.relay.dataflow_pattern.Dict" title="tvm.relay.dataflow_pattern.Dict"><em>Dict</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><a class="reference internal" href="../runtime.html#tvm.runtime.Object" title="tvm.runtime.Object"><em>Object</em></a><em>]</em><em>]</em>) – A dict of attributes to apply to the partitioned function</p></li>
<li><p><strong>check</strong> (<a class="reference internal" href="#tvm.relay.dataflow_pattern.Callable" title="tvm.relay.dataflow_pattern.Callable"><em>Callable</em></a><em>[</em><em>[</em><em>Expr</em><em>]</em><em>, </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a><em>]</em>) – A function to perform more complicated checks on the matched expression.
Returns true if partitioning should proceed, false otherwise.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The Expression with matched subgraphs replaced by function calls to that subgraph</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>tvm.relay.Expr</p>
</dd>
</dl>
</dd></dl>

</div>


           </div>
           
          </div>
          

<footer>

    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="testing.html" class="btn btn-neutral float-right" title="tvm.relay.testing" accesskey="n" rel="next">下一个 <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="backend.html" class="btn btn-neutral float-left" title="tvm.relay.backend" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> 上一个</a>
      
    </div>

<div id="button" class="backtop"><img src="../../../../_static//img/right.svg" alt="backtop"/> </div>
<section class="footerSec">
    <div class="footerHeader">
      <ul class="d-flex align-md-items-center justify-content-between flex-column flex-md-row">
        <li class="copywrite d-flex align-items-center">
          <h5 id="copy-right-info">© 2020 Apache Software Foundation | All right reserved</h5>
        </li>
      </ul>

    </div>

    <ul>
      <li class="footernote">Copyright © 2020 The Apache Software Foundation. Apache TVM, Apache, the Apache feather, and the Apache TVM project logo are either trademarks or registered trademarks of the Apache Software Foundation.</li>
    </ul>

</section>
</footer>
        </div>
      </div>

    </section>

  </div>
  

    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

  </body>
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
    <!-- Theme Analytics -->
    <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-75982049-2', 'auto');
    ga('send', 'pageview');
    </script>

    
   

</body>
</html>